# -*- coding: utf-8 -*-
"""mxOnline URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Import the include() function: from django.conf.urls import url, include
    3. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import url, include
from django.views.static import serve
from django.contrib import admin
from django.views.generic import TemplateView
import xadmin

from users.views import LoinView, LogOutView, RegisterView
from mxOnline.settings import MEDIA_ROOT
urlpatterns = [
    # url(r'^admin/', admin.site.urls),
    url(r'^xadmin/', xadmin.site.urls),
    # url(r'', TemplateView.as_view(template_name="userLogin.html"), name="index"),
    # url(r'^login/', TemplateView.as_view(template_name="userLogin.html"), name='login'),
    # 登录
    url(r'^login/', LoinView.as_view(), name="login"),
    # 退出登录
    url(r'^logout/', LogOutView.as_view(), name="logout"),
    # 注册操作
    url(r'^register/', RegisterView.as_view(), name="register"),
    # 获取验证码
    url(r'^captcha/', include('captcha.urls')),
    # 处理图片显示的url,使用Django自带serve,传入参数告诉它去哪个路径找，我们有配置好的路径MEDIAROOT
    url('media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT}),

]
